home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC-SIG: World of Utilities
/
PC-SIG's World of Utilities (PC-SIG) (1994).iso
/
UPDATES
/
DISK3050.ZIP
/
DEMO.BAT
< prev
next >
Wrap
DOS Batch File
|
1993-06-05
|
12KB
|
364 lines
echo off
cls
d /Yny// /'//This is a DEMO for the program D.EXE (&WPocketD&w). Do you want to proceed (Y@/N) ?'
if not errorlevel 2 goto fin
echo This demonstration shows a small sample of D.EXE's features. The user is
echo advised to run MENUD.EXE for a complete interactive demonstration of the
echo full range of features, and to run README for illustrative examples.
echo All files other than the original PocketD release files will be ignored.
echo D.EXE's internal screen size is set to 80 cols by 11 rows for demonstration
echo purposes. ( The menus below are all directly controlled by D.EXE ).
set d_opt2=/#80,11p:.d.exe/:.d.exe/- wh* .pcx
d /@n
if errorlevel 27 goto main2
echo Sorry! Demo requires full installation! (except .PCX file)
goto fin1
:main
cls
echo Returning to main menu..
:main2
d /Y_12345 /'//@t1. Directory formats/@t2. Template/@t3. File information/@t4. File selection/@t5. Help//@tESC exit//@t?'
if errorlevel 6 goto help
if errorlevel 5 goto select
if errorlevel 4 goto stats
if errorlevel 3 goto templ
if errorlevel 2 goto disp
goto exit
:disp
cls
d /Y1234 /'//@tChoose://@t1. Normal,@/w,@/m and @/t format/@t2. Bestfit/@t3. Subdir summary/@t4. Tailoring//@tESC cancel//@t?'
cls
if errorlevel 4 goto tail
if errorlevel 3 goto subdir
if errorlevel 2 goto bestfit
if errorlevel 1 goto wmt
goto main
:wmt
echo This is the default format: standard details sorted by file/dir name
echo D
d
echo.
pause
cls
echo This is the /w "wide" format giving only filename and size in KBytes
echo D /w
d /w
echo.
pause
cls
echo This is the /m "minimum" format giving only the filename
echo D /m
d /m
echo.
pause
cls
echo This is the /t "tiny" format grouping files by extension
echo D /t
d /t
echo.
pause
goto disp
:bestfit
echo This is the "Best-fit" format which automatically chooses the display format.
echo In this case /w format is chosen to fit the 80x11 format used by the demo.
echo D /b
d /b~.20
echo.
pause
cls
echo This can be modified by "column optimise" (/.k) to limit the No. of columns.
echo In this case the layout is altered to 3 columns which still fits inside 11 rows.
echo D /b/.k
d /b~.20/.k
echo.
pause
goto disp
:subdir
echo This demonstrates some of the subdirectory summary features of PocketD
d /Yny// /'/This will require creation of temporary subdirectories with files/copied into them. Ok ?'
if not errorlevel 2 goto disp
echo D N*.BAT D*.BAT /cc ATEMP1 ( command used for copy/create )
d n*.bat d*.bat /cc atemp1
echo.
md atemp2
echo Subdirs ATEMP1 and ATEMP2 created
pause
cls
echo The following uses /r to include a summary of the contents of subdir ATEMP1
echo and ATEMP2
echo D /r
d /rK.28
echo.
pause
cls
echo The following uses /S and /G to group contents of subdirs
echo D /wSG
d .\AT* *.* /wSG~.35
echo.
pause
cls
d /Y// /'//Deleting temporary files.'
echo D atemp1 atemp2 /zd ( command used to delete )
d atemp1 atemp2 /Ihzd
echo.
pause
goto disp
:tail
echo PocketD offers 19 tailoring options. The following shows four of these:
echo 1. Unbroken names 2. 1jan91 date format 3. Lowercase 4. Sorting by row
echo D /.umlr
d /.umlr/~.28
echo.
pause
goto disp
:templ
cls
echo PocketD has a very powerful TEMPLATE facility that can be used for display
echo or execution purposes. It can accept 50 possible parameters, a few shown below.
d /Y12// /'//@tChoose://@t1. Display output/@t2. Execution//@tESC cancel//@t?'
cls
if errorlevel 2 goto t_exec
if errorlevel 1 goto t_disp
goto main
:t_disp
echo The display template can be used in many ways. The simple example at the
echo bottom of the screen simply outputs an X for each matching file/dir.
echo D /w
d /w
echo.
echo D [X]
d [X]
echo.
pause
cls
echo The template can accept parameters such as $f giving the filename
echo D [$f ]
d [$f ]
echo.
echo.
echo It can also accept formatted field widths e.g. $16f for padding to width 16
echo D [$16f]
d [$16f]
echo.
pause
cls
echo $10n gives only the name part without the extension, padded to width 10:
echo D [$10n]
d [$10n]
echo.
echo.
echo "//" in the template will add a newline:
echo D ?????.* [$10n//]
d ?????.* [$10n//]
echo.
pause
goto templ
:t_exec
echo PocketD can be used to run a template for a selected group of files. For
echo example, the following could be used to move each file extension group to
echo its own archive file:
echo (R? below causes PocketD to echo each line without running it. R runs).
echo D /e [PKZIP -m $e *.$e]R?
d /e [PKZIP -m $e *.$e]R?
echo.
pause
cls
echo PocketD can run multi-line sequences. e.g. To move each file extension
echo group to its own subdir, named by the extension:
echo D /e [md $e//copy *.$e $e]R?
D /e [md $e//copy *.$e $e]R?!E- *.d*
echo.
pause
goto templ
:stats
cls
echo PocketD can provide additional information about files and present file
echo data in a number of ways. The following gives a few examples of this.
d /Y123// /'//@tChoose://@t1. Barchart display/@t2. Execution size && Compression/@t3. Extension summary//@tESC cancel//@t?'
cls
if errorlevel 3 goto exten
if errorlevel 2 goto exec
if errorlevel 1 goto bar
goto main
:bar
echo The following chart show the relative size of all files represented as a
echo bar chart. (only 1st 14 files shown).
echo D /g
d /gK.14
echo.
pause
cls
echo The chart is improved by sorting the files by size (ss) & showing the relative
echo percentage usage of each (%%). It also shows the size in terms of space used
echo rather than actual size (U).
echo D /ss /%%U /g (or D /ss/%Ug- *.BAT etc..)
d /ss/%%UgK.14
echo.
pause
goto stats
:exec
echo PocketD can show the minimum run size of an EXE program in KBytes using /M.
echo Executable files can be compressed by PKLITE, DIET and LZEXE. The /C option
echo will show files that are compressed by flagging the attribute as p,d or l
echo D /EMC ( E=executable M=exec size C=Compress check )
d /EMC
echo.
pause
goto stats
:exten
echo PocketD can summarise files and subdirs by EXTENSION, allowing the user
echo to assess the space used by each extension present.
echo D /e
d /eh.2
echo.
echo This could be used with other options to provide further information. e.g.
echo Showing only the top 4 extensions (in terms of size) and plotting a barchart.
echo D /eK.4g%%/ss (K.4 = 1st 4, /ss = sort by size, g = barchart)
d /eK.4g%%/ss/h.2
echo.
pause
goto stats
:select
cls
echo PocketD can apply many criteria for selecting files and subdirectories.
d /Y123 /'/@tChoose://@t1. Filespecs/@t2. Size/@t3. String searching//@tESC cancel//@t?'
cls
if errorlevel 3 goto string
if errorlevel 2 goto size
if errorlevel 1 goto filesp
goto main
:filesp
echo PocketD uses a generalised filespec system that can include and exclude names.
echo The following shows all executable files in the current directory:
echo D /mhE/.u ( m=minimum h=no header E=executable /.u=unbroken names )
d /mhE/.u
echo.
echo The group of files selected can be reduced using filespecs:
echo D /mhE/.u *L*A* G* ( Only names with an L followed later by A
echo or starting with the letter G )
d /mhE/.u *L*A* G*
echo.
echo The command line can also include "exclusion" filespecs:
echo D /mhE/.u *L*A* G* /- *O* ??L* ( also excluding all names containing O
echo or the letter L as the 3rd character)
d /mhE/.u *L*A* G* /- *O* ??L*
echo.
pause
cls
echo PocketD also allows "type" specifications in filenames, for example:
echo D *=D* *=n* /hm
d *=D* *=n* /hm
echo.
echo This uses "=D" to match any name containing a digit, and "=n" to match
echo any name that contains a non-alphanumeric character (uppercase indicates
echo match, lowercase for non-match). Also supported: =A/=a match alpha/non-alpha.
pause
goto select
:size
echo PocketD can select files by size (and also date, See D /??).
echo The following shows all non-executable files sorted by size:
echo D /h!Ess ( h=no header !E=NOT executable ss=sort by size )
d /h!Ess
echo.
echo A size restriction could be added to this:
echo D /h!Ess/}20000 ( greater or equal to 20000 )
D /h!Ess/}20000
echo.
echo This could be replaced by a range 3k to 4k (k=Kilobytes):
echo D /h!Ess/}3k{4k
D /h!Ess/}3k{4k
pause
goto select
:string
echo PocketD can select files by the strings they contain (m=minimum h=no header):
echo D *.BAT /mh'not' ( only *.BAT files containing 'not' )
d *.bat /mh'not'
echo.
echo This can be inverted to only those not containing 'not':
echo D *.BAT /mh!'not' ( !'not' = not including 'not' )
d *.BAT /mh!'not'
echo.
echo Extra options can be added to show 1st match found, but no dir listing:
echo D *.BAT /mh'not'Sd ( S = show strings d = no directory )
d *.BAT /mh'not'Sd
pause
cls
echo The string searching facility can be used to search for types of character,
echo for example: Numeric digit, Alphabetic, Alpha-numeric, space characters etc..
echo D *.BAT /hm'subdir'Sd ( files containing the string 'subdir' )
d *.bat /hm'subdir'Sd/- d*
echo.
echo This could be modified to find files with 'subdir' but not 'subdirectory':
echo D *.BAT /hm'subdir@a'Sd ( @a = non-alphabetic character )
d *.bat /hm'subdir@a'Sd/- d*
echo.
echo Other options include L/l show/don't show line numbers, * show all strings
echo and "" instead of '' for case-insensitive search.
echo.
pause
goto select
:help
cls
echo PocketD comes with a number of documentation files.
echo This demo only gives access to the on-line help.
echo (PocketD will prompt the user for a number between 1-4 before allowing access)
echo.
echo 1. The single page help, accessed by D /?
pause
d /?
pause>nul
cls
echo 2. The User Guide, assessed by D /??
pause
d /??
cls
echo 3. The on-line manual, given for the example D /?c
pause
d /?c
goto main
:exit
cls
echo DEMO terminated
echo This demonstration has not covered the following major features:
echo . The New MENUD.EXE 60-menu front-end to D.EXE. Try it!
echo . Color configuration, see SETCOL.EXE
echo . Browsing through subdirectories and archives (see /Q)
echo . Scrolling display and execution templates (see ARCVIEW.BAT ad Q.BAT)
echo . COPY/MOVE facilities, including copy to multi-disk, conditional copy,
echo multiple sources, subtree copying and "safe" copy features.
echo . ARCHIVE viewing and searching in ZIP/ARC/ZOO/LZH/ARJ/PAK archives
echo . Using PocketD to emulate utilities such as NCD, WHICH and MAKE etc..
echo . Using the separate display and execution TEMPLATE(s) to create utilities
echo that can intelligently interact with the user.
echo . ENVIRONMENT VARIABLE analysis from command line. e.g. D :PATH
echo . FILE SEARCH across multiple drives/subdirs using multiple criteria
echo . TOUCH and full ATTRIB modification of files
echo . ON-LINE FILE VIEWER in HEX or TEXT, providing text searching.
echo . ON-LINE BROWSING of file lists
echo . The 37 USER-DEFINED parameter names
echo You are referred to the on-line guide accessed by typing D /?? for these.
:fin1
set d_opt2=
if "%d_col%"=="" goto fin
:fin